<!--title-->
<div class="mnav1">
	<div class="m_nav">
		<div class="nav_left">
			<em class="home_icon"><?=$this->sys_name?></em><span>&nbsp;&gt;&nbsp;</span><font>首页</font>
		</div>
	</div>
</div>
<!--index-content-->
<div class="index-content">
	<p><?=$_SESSION['identity']['realname']?>，欢迎回来</p>
	<?php $ext = new Sys_Extensions();?>
	<?php if("LEVEL-1" == $_SESSION['identity']['level']):?>
	<form action="/index/index" name="form1" method="GET">
	<input type="text" name="date_start" id="date_start" value="<?=$this->date_start?>" style="width: 100px"> ~ <input type="text" name="date_end" id="date_end" value="<?=$this->date_end?>" style="width: 100px">
	&nbsp;&nbsp;<input type="submit" class="button-index" value="搜" />
	<p>待审批合同数：<em> <a href="/contracts/index?via=index1" style="color: red"><?=$ext->NumberFormat($this->index_info['pending_approval_contracts'],1)?></a> </em></p>
	<p>掉单数：<em> <a href="/contracts/index?via=index2&date_start=<?=$this->date_start?>&date_end=<?=$this->date_end?>" style="color: red"><?=$ext->NumberFormat($this->index_info['lost_clients'],1)?></a> </em></p>
	<p>历史欠款额：<em> <a href="/contracts/index?via=index3&date_start=<?=$this->date_start?>&date_end=<?=$this->date_end?>" style="color: red"><?=$ext->NumberFormat($this->index_info['qiankuan_total'],1)?></a> </em></p>
	<br>
	<?php foreach($this->index_info['products'] as $products):?>
	<br>
	<p><em><?=$products['product_name']?></em></p>
	<br>
	<p>签单额：<em> <?=$ext->NumberFormat($products['qiandan'],1)?> </em></p>
	<p>回款额：<em> <?=$ext->NumberFormat($products['huikuan'],1)?> </em></p>
	<p>欠款额：<em> <?=$ext->NumberFormat($products['qiankuan'],1)?> </em></p>
	<p>到期合同数：<em> <?=$ext->NumberFormat($products['daoqi'],1)?> </em></p>
	<p>在执行合同数：<em> <?=$ext->NumberFormat($products['zhixing'],1)?> </em></p>
	<p>新签合同数：<em> <?=$ext->NumberFormat($products['xinqian'],1)?> </em></p>
	<?php endforeach;?>
	</form>
	<?php elseif("LEVEL-2" == $_SESSION['identity']['level']):?>
	<form action="/index/index" name="form1" method="GET">
	<input type="text" name="date_start" id="date_start" value="<?=$this->date_start?>" style="width: 100px"> ~ <input type="text" name="date_end" id="date_end" value="<?=$this->date_end?>" style="width: 100px">
	&nbsp;&nbsp;<input type="submit" class="button-index" value="搜" />
	<p>待审批合同数：<em> <a href="/contracts/index?status=0&via=index" style="color: red"><?=$ext->NumberFormat($this->index_info['pending_approval_contracts'],1)?></a> </em></p>
	<p>掉单数：<em> <?=$ext->NumberFormat($this->index_info['lost_clients'],1)?> </em></p>
	<p>历史欠款额：<em> <?=$ext->NumberFormat($this->index_info['qiankuan_total'],1)?> </em></p>
	<br>
	<?php foreach($this->index_info['products'] as $products):?>
	<br>
	<p><em><?=$products['product_name']?></em></p>
	<br>
	<p>签单额：<em> <?=$ext->NumberFormat($products['qiandan'],1)?> </em></p>
	<p>回款额：<em> <?=$ext->NumberFormat($products['huikuan'],1)?> </em></p>
	<p>欠款额：<em> <?=$ext->NumberFormat($products['qiankuan'],1)?> </em></p>
	<p>到期合同数：<em> <?=$ext->NumberFormat($products['daoqi'],1)?> </em></p>
	<p>在执行合同数：<em> <?=$ext->NumberFormat($products['zhixing'],1)?> </em></p>
	<p>新签合同数：<em> <?=$ext->NumberFormat($products['xinqian'],1)?> </em></p>
	<?php endforeach;?>
	</form>
	<?php elseif("LEVEL-3" == $_SESSION['identity']['level']):?>
	<br>
	<p>待审批合同数：<em> <a href="/contracts/index?status=1&via=index" style="color: red"><?=$ext->NumberFormat($this->index_info['pending_approval_contracts'],1)?></a> </em></p>
	<?php elseif("LEVEL-4" == $_SESSION['identity']['level']):?>
	<form action="/index/index" name="form1" method="GET">
	<input type="text" name="date_start" id="date_start" value="<?=$this->date_start?>" style="width: 100px"> ~ <input type="text" name="date_end" id="date_end" value="<?=$this->date_end?>" style="width: 100px">
	&nbsp;&nbsp;<input type="submit" class="button-index" value="搜" />
	<p>待审批合同数：<em> <a href="/contracts/index?status=0&via=index" style="color: red"><?=$ext->NumberFormat($this->index_info['pending_approval_contracts'],1)?></a> </em></p>
	<p>掉单数：<em> <?=$ext->NumberFormat($this->index_info['lost_clients'],1)?> </em></p>
	<p>历史欠款额：<em> <?=$ext->NumberFormat($this->index_info['qiankuan_total'],1)?> </em></p>
	<br>
	<?php foreach($this->index_info['products'] as $products):?>
	<br>
	<p><em><?=$products['product_name']?></em></p>
	<br>
	<p>签单额：<em> <?=$ext->NumberFormat($products['qiandan'],1)?> </em></p>
	<p>回款额：<em> <?=$ext->NumberFormat($products['huikuan'],1)?> </em></p>
	<p>欠款额：<em> <?=$ext->NumberFormat($products['qiankuan'],1)?> </em></p>
	<p>到期合同数：<em> <?=$ext->NumberFormat($products['daoqi'],1)?> </em></p>
	<p>在执行合同数：<em> <?=$ext->NumberFormat($products['zhixing'],1)?> </em></p>
	<p>新签合同数：<em> <?=$ext->NumberFormat($products['xinqian'],1)?> </em></p>
	<?php endforeach;?>
	</form>
	<?php endif;?>
</div>

<script>
<?php if(in_array($_SESSION['identity']['level'], array("LEVEL-1", "LEVEL-2", "LEVEL-3", "LEVEL-4"))):?>
$(function() {
	$( "#date_start" ).datepicker({ dateFormat: 'yy-mm-dd'});
});

	$(function() {
	$( "#date_end" ).datepicker({ dateFormat: 'yy-mm-dd'});
});
<?php endif;?>

<?php if($this->redirect):?>
alert("欢迎进入系统，为确保您的账户安全，请修改初始密码。");
window.location.href="/others/profile"; 
<?php endif;?>
</script>